package com.wjh.controller;


import com.wjh.pojo.Expressage;
import com.wjh.service.ExpressageOrderService;
import com.wjh.service.ExpressageService;
import com.wjh.utils.ResponseResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("order")
public class ExpressageOrderController {

    @Resource
    private ExpressageOrderService expressageOrderService;

    @Resource
    private ExpressageService expressageService;


    @GetMapping("/list")
    public ResponseResult getOrderListAll(Integer pageNum,Integer pageSize,String phone,
                                          String orderNumber,String consignerName,String createTime){

        return expressageOrderService.getOrderListAll(pageNum,pageSize,phone,orderNumber,consignerName,createTime);

    }

    /**
     * 根据订单生成快递数据
     *
     */
    @PostMapping("/add")
    public ResponseResult addOrderCreate(@RequestBody Expressage expressage){
        return expressageService.addExpressage(expressage);
    }

    /**
     * 删除订单数据
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult delOrderById(@PathVariable("id")List<Integer> id){
        return expressageOrderService.delOrderById(id);
    }
}
